let t = require;
let  e = module
let  o =  e.exports;
 o.default =  e.exports;

                'use strict';
                console.log("start");
                var _n9,
                    i =
                    (this && this.__extends) ||
                    ((_n9 = function n(t, e) {
                            return (_n9 =
                                Object.setPrototypeOf ||
                                ({
                                        __proto__: []
                                    }
                                    instanceof Array &&
                                    function(t, e) {
                                        t.__proto__ = e;
                                    }) ||
                                function(t, e) {
                                    for (var o in e) {
                                        Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
                                    }
                                })(t, e);
                        }),
                        function(t, e) {
                            function o() {
                                this.constructor = t;
                            }
                            _n9(t, e),
                                (t.prototype =
                                    null === e ?
                                    Object.create(e) :
                                    ((o.prototype = e.prototype), new o()));
                        });
                Object.defineProperty(o, '__esModule', {
                        value: !0
                    }),
                    (o.AbsBuffCtrl = void 0);
                var r = t('AbsObject'),
                    a = t('AbsActor'),
                    s = t('AbsBuff'),
                    c = (function(t) {
                        function e(e) {
                            var o = t.call(this) || this;
                            return (
                                (o._buffs = []),
                                (o._adds = []),
                                (o._removes = []),
                                (o._actor = e),
                                o
                            );
                        }
                        return (
                            i(e, t),
                            (e.prototype.setActor = function(t) {
                                this._actor = t;
                            }),
                            Object.defineProperty(e.prototype, 'buffs', {
                                get: function get() {
                                    return this._buffs;
                                },
                                enumerable: !1,
                                configurable: !0
                            }),
                            (e.prototype.onBuffStop = function(t) {
                                this.remove(t);
                            }),
                            (e.prototype.addBuff = function() {
                                return null;
                            }),
                            (e.prototype.removeBuff = function(t) {
                                this.remove(t);
                            }),
                            (e.prototype.getAddBuff = function(t) {
                                for (var e = 0; e < this._adds.length; e++) {
                                    if (this._adds[e].id == t) return this._adds[e];
                                }
                                return null;
                            }),
                            (e.prototype.hasBuff = function(t) {
                                return null != this.getBuff(t);
                            }),
                            (e.prototype.add = function(t) {
                                if (null != this._actor)
                                    return this._adds ?
                                        (t.setActor(this._actor), this._adds.push(t), t) :
                                        null;
                            }),
                            (e.prototype.remove = function(t) {
                                null != this._actor &&
                                    (t.stop(), this._removes && this._removes.push(t));
                            }),
                            (e.prototype.removeBuffById = function(t) {
                                var e = this.getBuff(t);
                                e && this.remove(e);
                            }),
                            (e.prototype.clearBuffs = function() {
                                if (this._adds && this._adds.length) {
                                    for (var t = 0; t < this._adds.length; t++) {
                                        this._adds[t].destroy();
                                    }
                                    this._adds.length = 0;
                                }
                                if (this._removes && this._removes.length) {
                                    for (t = 0; t < this._removes.length; t++) {
                                        this._removes[t].destroy();
                                    }
                                    this._removes.length = 0;
                                }
                                if (this._buffs && this._buffs.length) {
                                    for (t = 0; t < this._buffs.length; t++) {
                                        this._buffs[t].destroy();
                                    }
                                    (this._buffs.length = 0), this.emit(a.ActorEvent.RemoveBuff);
                                }
                            }),
                            (e.prototype._addBuff = function() {
                                if (this._adds) {
                                    for (var t = 0; t < this._adds.length; t++) {
                                        var e = this._adds[t]; -
                                        1 == this._findBuff(e) &&
                                            (this._buffs.push(e),
                                                this._actor.emit(a.ActorEvent.AddBuff, e),
                                                e.start(),
                                                e.on(s.BuffEvent.Stop, this.onBuffStop, this));
                                    }
                                    this._adds.length > 0 &&
                                        (this.emit(a.ActorEvent.AddBuff), (this._adds.length = 0));
                                }
                            }),
                            (e.prototype._removeBuff = function() {
                                if (this._removes) {
                                    for (var t = 0; t < this._removes.length; t++) {
                                        var e = this._removes[t],
                                            o = this._findBuff(e);
                                        o > -1 && this._buffs.splice(o, 1),
                                            e.destroy(),
                                            this._actor.emit(a.ActorEvent.RemoveBuff, e);
                                    }
                                    this._removes.length > 0 &&
                                        (this.emit(a.ActorEvent.RemoveBuff),
                                            (this._removes.length = 0));
                                }
                            }),
                            (e.prototype._findBuff = function(t) {
                                if (t)
                                    for (var e = 0; e < this._buffs.length; e++) {
                                        var o = this._buffs[e];
                                        if (t.id == o.id) return e;
                                    }
                                return -1;
                            }),
                            (e.prototype.getBuff = function(t) {
                                for (var e = 0; e < this._buffs.length; e++) {
                                    if ((o = this._buffs[e]).id == t && o.isValid) return o;
                                }
                                for (e = 0; e < this._adds.length; e++) {
                                    var o;
                                    if ((o = this._adds[e]).id == t && o.isValid) return o;
                                }
                                return null;
                            }),
                            (e.prototype.update = function(t) {
                                if (this._buffs) {
                                    var e = this._buffs.length,
                                        o = void 0;
                                    this._removeBuff(), this._addBuff();
                                    for (var n = 0; n < e; n++) {
                                        (o = this._buffs[n]) && o.update(t);
                                    }
                                }
                            }),
                            (e.prototype.onDestroy = function() {
                                t.prototype.onDestroy.call(this),
                                    this.clearBuffs(),
                                    (this._adds = null),
                                    (this._removes = null),
                                    (this._buffs = null);
                            }),
                            e
                        );
                    })(r.AbsObject);
                (o.AbsBuffCtrl = c), console.log("end");
            module.exports =  e.exports;